<!DOCTYPE html>
<head>
  <!-- Standard Meta -->
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <!-- Site Properities -->
  <title>Homepage Example - Semantic</title>

  <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" type="text/css" href="packaged/css/semantic.css">
  <link rel="stylesheet" type="text/css" href="packaged/css/homepage.css">

  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
  <script src="packaged/javascript/semantic.js"></script>
  <script src="packaged/javascript/homepage.js"></script>
<script>
function addtocart(item){
    var value=item.id;                
    $.ajax({
        type: "GET",
        url: "/AddToCart?",                
        dataType: "json",
        data: {"Productid" : value},
        
        success:function(data){
            if(data){
                alert("worked");
            }
        },
        error:function(){
            alert('not worked.');
        } 

    })       
};

function ajaxGET(item,url){
	var xmlhttp;
	var header = "Productid";
	var value = item.id;
	var urls = url+"?Productid=" + value;
	if(window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  
	  }
	  
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  alert("new activeX");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if(xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	   		 item.innerHTML="Added";
	   		 alert("Added");
	   		 
	    }
	  };
	xmlhttp.open("GET",urls,true);
	xmlhttp.send();
	
}
function ajaxPOST(item){
	var xmlhttp;
	var header = "Productid";
	var value = item.id;
	xmlhttp=new XMLHttpRequest();
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	if(window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	  }
	  
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  alert("new activeX");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if(xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	   		 item.innerHTML="Added";
	   		 alert("Added");
	   		 
	    }
	  };
	xmlhttp.open("POST","AddToCart",true);
	xmlhttp.send("Productid="+value);
	
}


</script>
</head>